<header>
	<h3><?= lang('product_manage') ?> <span>- <?= lang('product_create') ?></span></h3>
</header>
<section class="welly">
	<form id="create_product" method="post"	action="" class="form-horizontal" enctype="multipart/form-data">
		<input type="hidden" name="submit" value="1"/>
		<ul class="nav nav-tabs tab_styled_light">
			<li class="active"><a href="#tab1" data-toggle="tab"><?= lang('product_data') ?></a></li>
			<li><a href="#tab2" data-toggle="tab"><?= lang('product_info') ?></a></li>
			<li><a href="#tab3" data-toggle="tab"><?= lang('product_images') ?></a></li>
			<li><a href="#tab4" data-toggle="tab"><?= lang('product_catalogue') ?></a></li>
		</ul>
		<div class="tab-content tab_content_light">
			<div id="tab1" class="tab-pane active">
				<div class="control-group">
					<label class="control-label"><?= lang('product_image') ?></label>
					<div class="controls">
						<img style="width: 150px; margin-bottom: 5px" id="albumImage"  src="<?= image_url($product->image) ?>"/>
						<input type="hidden" name="image_id" value="<?= $product->image_id ?>"/>
					</div>
					<div class="controls">
						<input id="selectfile" type="button" class="btn" value="<?= lang('select_file') ?>"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label"><?= lang('product_home') ?></label>
					<div class="controls">
						<input type="checkbox" name="home"  value="1"  <?=$product->home==1?'checked':''?>/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label"><?= lang('product_index') ?></label>
					<div class="controls">
						<input type="input" name="index"  value="0"/>
					</div>
				</div>
			</div>
			<div id="tab2" class="tab-pane fade">
				<ul class="nav nav-tabs tab_styled_light">
					<? foreach ($langs as $l) { ?>
						<li<?= $l->id == $lang ? ' class="active"' : '' ?>><a href="#tab2<?= $l->id ?>" data-toggle="tab"><?= $l->name ?></a></li>
					<? } ?>
				</ul>
				<div class="tab-content tab_content_light">
					<? foreach ($langs as $l) { ?>
						<div id="tab2<?= $l->id ?>" class="tab-pane<?= $l->id == $lang ? ' active' : ' fade' ?>">
							<div class="control-group">
								<label class="control-label"><?= lang('product_name') ?></label>
								<div class="controls">
									<input type="text" name="info[<?= $l->id ?>][name]" class="input-xlarge" value="<?= $product->info[$l->id]->name ?>"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label"><?= lang('product_description') ?></label>
								<div class="controls">
									<textarea id ="description<?= $l->id ?>" name="info[<?= $l->id ?>][description]" class="input-xlarge" ><?= $product->info[$l->id]->description ?></textarea>
									<script type="text/javascript">
										init_ckeditor('description<?= $l->id ?>')
									</script>
								</div>
							</div>
						</div>
					<? } ?>
				</div>
			</div>
			<div id="tab3" class="tab-pane fade">
				<div class="control-group">
					<label class="control-label" for="images"><?= lang('product_images') ?></label>
					<div id="images" class="controls">
						<div>
							<input type="button" id="selectfiles" class="btn" value="<?= lang('select_files') ?>"/>
						</div>
					</div>
				</div>
				<ul id="basicGallery" class="gallery_basic">
					<? foreach ($product->images as $img) { ?>
						<li>
							<img style="max-width: 150px;max-height: 100px"class="placeholder" src="<?= image_url($img->thumb) ?>" alt="<?= $img->image_id ?>"/>
							<input type="hidden" name="images[]" value="<?= $img->image_id ?>" />
							<div>
								<ul style="width:67px">
									<li class="edit"><a href="<?= image_url($img->path) ?>">View</a></li>
									<li class="delete" data="<?= $img->image_id ?>"><a href="#">Delete</a></li>
								</ul>
							</div>
						</li>
					<? } ?>
				</ul>
			</div>
			<div id="tab4" class="tab-pane fade">
				<label class="checkbox"><input type="checkbox" id="tab4_check"><b><?= lang('select_all') ?></b></label>
				<? foreach ($catalogues as $catalogue) { ?>
					<label class="checkbox">
						<input type="checkbox" value="<?= $catalogue->id ?>" name="catalogues[]" /><?= $catalogue->pre ?><?= $catalogue->name ?>
					</label>
				<? } ?>
			</div>
		</div>
		<hr>
		<div>
			<input type="submit" class="btn btn-success" />
			<button class="btn"><?= lang('cancel') ?></button>
		</div>
	</form>
</section>